☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

key

Table of contents

Description:

This key defines which key an option in the Sort dropdown should use to sort files in your Collection browser.

You must define this key for every entry in the sort_options array for the object to function.

Value must be the name of a structured data key in your Collection files.

If some files in your Collection do not have this data key, CloudCannon will sort those in ascending alphabetical order, after the file sorted by your data key in the Collection browser.

Appears in:
└── collections_config
    └── *
        └── sort_options
            └── [*]
                └── key
Type:
string Required
Examples:

In this example, the "Author (A-Z)" option in the Sort dropdown will use the author key to sort files in the blog Collection browser.

Copied to clipboard
collections_config:
  blog:
    sort_options:
      - key: author
        order: ascending
        label: Author (A-Z)
{
  "collections_config": {
    "blog": {
      "sort_options": [
        {
          "key": "author",
          "order": "ascending",
          "label": "Author (A-Z)"
        }
      ]
    }
  }
}
Open in a new tab